<template>
	<view class="content">
		<!-- <view style="width: 100%; height: 80rpx; border: none; display: flex; justify-content: space-between; align-items: center; background-color: #fa341b">
			<view style="margin-left: 20rpx; color: #ffffff" @click="fanhui"> &lt </view>
			<view style="color: #ffffff; font-size: 30rpx; font-weight: 800; margin-right: 290rpx"> 我的余额 </view>
		</view> -->
		<view class="too">
			<view class="too_a">
				<p class="too_aa">当前余额</p>
				<p class="too_ab">{{ money }}元</p>
			</view>
			<view class="too_b" @click="tixian">提现</view>
		</view>
		<view style="width: 100%; height: 80rpx; border: 1rpx solid #eeeeee; display: flex; justify-content: space-between; margin-top: 15rpx">
			<view :class="ZT == 1 ? 'yes_xian' : 'no_xian'" @click="zt_a">余额流水</view>
			<view :class="ZT == 2 ? 'yes_xian' : 'no_xian'" @click="zt_b">提现记录</view>
		</view>
		<!-- 余额流水 -->
		<view class="neirong" v-if="ZT == 1">
			<view class="neirong_a" v-for="(i, index) in data_a" :key="index">
				<image src="../../../static/jingzhuang.png" mode="" v-show="i.plus_minus == 1" style="width: 100rpx; height: 100rpx; margin-left: 15rpx"></image>
				<image src="../../../static/tixian.png" mode="" v-show="i.plus_minus == 2" style="width: 100rpx; height: 100rpx; margin-left: 15rpx"></image>
				<view class="qian">
					<view class="qian_a">
						<p class="qian_a_a">{{ i.title }}</p>
						<p class="qian_a_b">{{ i.create_time }}</p>
					</view>
				</view>
				<view class="hou">
					{{ i.money }}
				</view>
			</view>
		</view>
		<!-- 提现记录 -->
		<view class="neirong" v-if="ZT == 2">
			<view class="neirong_a" v-for="(i, index) in data" :key="index">
				<image src="../../../static/tixian.png" mode="" style="width: 100rpx; height: 100rpx; margin-left: 15rpx"></image>
				<view class="qian">
					<view class="qian_a">
						<p class="qian_a_a">{{ i.nickname }}</p>
						<p class="qian_a_b">{{ i.create_time }}</p>
					</view>
				</view>
				<view class="hou">
					{{ i.money }}
					<view class="zhuantai_b">{{ i.status }}</view>
					<view style="width: 270rpx; color: #333333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis">{{ i.note }}</view>
				</view>
			</view>
		</view>

		<u-loadmore :status="status" />
	</view>
</template>

<script>
export default {
	data() {
		return {
			status: "noMore",
			data: [],
			data_a: [],
			limit: 999999999999,
			page: 1,
			money: 0,
			money_a: 0,
			total: 0,
			tixan_ztai: 2,
			ZT: 1,
			tu_zt: false,
			limit1: 10,
			page1: 1,
			total1: "",
		};
	},
	onLoad() {
		this.getBal();
		this.getBal_b();
		uni.setNavigationBarColor({
			frontColor: "#ffffff",
			backgroundColor: "#FA341B",
			animation: {
				duration: 400,
				timingFunc: "easeIn",
			},
		});
	},
	methods: {
		fanhui() {
			wx.switchTab({
				url: "../me_a",
			});
		},
		zt_a() {
			this.ZT = 1;
		},
		zt_b() {
			this.ZT = 2;
		},
		async getBal() {
			let obj = {
				uid: uni.getStorageSync("uid"),
				page: this.page,
				limit: this.limit,
			};
			const res = await this.$u.post("api/user/user_money", obj, {});
			if (!res.code) uni.$showMsg();
			this.money = res.data.money;
			this.total = res.data.total;
			this.data = [...this.data, ...res.data.info];
			this.page++;
			console.log("res >>  ", res);
		},
		async getBal_b() {
			let obj = {
				uid: uni.getStorageSync("uid"),
			};
			const res = await this.$u.post("api/user/user_money_log", obj, {});
			if (!res.code) uni.$showMsg();
			this.money_a = res.data.money;

			this.data_a = res.data.info;

			console.log("res >>  ", res);
		},
		tixian() {
			wx.navigateTo({
				url: "./tixina",
			});
		},
	},
	// onReachBottom() {
	// 	if (this.data.length >= this.total) {
	// 		this.status = 'noMore';
	// 	} else {
	// 		this.status = 'loading';
	// 		this.getBal();
	// 		// this.getBal_b();
	// 	}
	// },
};
</script>

<style lang="scss" scoped>
.content {
	width: 100%;
	height: 100vh;
	background-color: #f5f8fd;
}
.too {
	width: 100%;
	background-color: #fa341b;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 30rpx;

	.too_a {
		width: 500rpx;
		height: 100rpx;
		margin-left: 30rpx;
		.too_aa {
			color: #ffffff;
			font-size: 20rpx;
		}
		.too_ab {
			color: #ffffff;
			font-size: 36rpx;
			padding-top: 15rpx;
		}
	}
	.too_b {
		width: 116rpx;
		height: 44rpx;
		line-height: 44rpx;
		text-align: center;
		color: #fa341b;
		background-color: #ffffff;
		border-radius: 10rpx;
		margin-right: 44rpx;
	}
}
.yes_xian {
	width: 50%;
	height: 80rpx;
	text-align: center;
	line-height: 80rpx;
	font-size: 32rpx;
	color: #ffffff;
	background-color: #fa341b;
}
.no_xian {
	width: 50%;
	height: 80rpx;
	text-align: center;
	line-height: 80rpx;
}

.neirong {
	width: 690rpx;
	border-radius: 10rpx;
	margin-left: 30rpx;
	margin-top: 34rpx;
	.neirong_a {
		width: 700rpx;
		height: 140rpx;
		margin-left: 0rpx;
		background-color: #ffffff;
		border-bottom: 1rpx solid #f5f5f5;
		display: flex;
		// justify-content: space-between;
		align-items: center;
		// border: 1rpx solid red;
		.qian {
			height: 140rpx;
			width: 300rpx;
			display: flex;
			justify-content: space-between;
			margin-left: 10rpx;
			.qian_a {
				height: 140rpx;
				width: 300rpx;
				// border: 1rpx solid red;
				.qian_a_a {
					color: #333333;
					font-size: 32rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					font-weight: 800;
					margin-top: 22rpx;
				}
				.qian_a_b {
					font-size: 18rpx;
					color: #333333;
					margin-top: 15rpx;
				}
			}
		}
		.hou {
			height: 100rpx;
			width: 250rpx;
			line-height: 40rpx;
			text-align: center;
			color: #fa341b;
			font-size: 28rpx;
			// border: 1rpx solid red;
			.zhuantai_a {
				height: 60rpx;
				width: 280rpx;
				line-height: 60rpx;
				color: #fabf37;
				text-align: center;
			}
			.zhuantai_b {
				height: 30rpx;
				width: 280rpx;
				line-height: -60rpx;
				color: #2172cf;
				text-align: center;
			}
			.zhuantai_c {
				height: 60rpx;
				width: 280rpx;
				line-height: 60rpx;
				color: #fa341b;
				// border: 1rpx solid red;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				text-align: center;
			}
		}
	}
}
</style>
